package cn.huq.day03

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object FullJoinDemo {
  def main(args: Array[String]): Unit = {
    val conf: SparkConf = new SparkConf().setAppName("FullJoinDemo").setMaster("local")
    val sc = new SparkContext(conf)

    val rdd1: RDD[(String, Int)] = sc.parallelize(List(("tom", 1), ("kitty", 2), ("tom", 3), ("jetty",2)))
    val rdd2: RDD[(String, Int)] = sc.parallelize(List(("jetty", 1), ("shuke", 2), ("tom", 1)))

    val rdd3: RDD[(String, (Int, Option[Int]))] = rdd1.leftOuterJoin(rdd2)

    println(rdd3.collect().toBuffer)

  }
}
